package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppHostInfo;

@Mapper
public interface AppHostInfoDao {

    @Select("select * from app_host_info t where t.id = #{id}")
    AppHostInfo getById(Long id);

    @Delete("delete from app_host_info where id = #{id}")
    int delete(Long id);

    int update(AppHostInfo appHostInfo);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_host_info(fid, hostcode, hostname, remark, descs, address, flag) values(#{fid}, #{hostcode}, #{hostname}, #{remark}, #{descs}, #{address}, #{flag})")
    int save(AppHostInfo appHostInfo);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppHostInfo> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
